package com.elminster.data.import0.ds;

import java.util.Date;

import org.apache.commons.lang.builder.ReflectionToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;

import com.elminster.util.DateUtil;

public class ExpensesDataStructure {

    private String dateStr;
    private String label;
    private String amountStr;
    
    /**
     * @return the dateStr
     */
    public String getDateStr() {
        return dateStr;
    }
    
    /**
     * @param dateStr the dateStr to set
     */
    public void setDateStr(String dateStr) {
        this.dateStr = dateStr;
    }
    
    public Date getDate() {
        return DateUtil.string2Date(dateStr, "M/d/yy");
    }
    
    /**
     * @return the label
     */
    public String getLabel() {
        return label;
    }
    
    /**
     * @param label the label to set
     */
    public void setLabel(String label) {
        this.label = label;
    }
    
    /**
     * @return the amountStr
     */
    public String getAmountStr() {
        return amountStr;
    }
    
    /**
     * @param amountStr the amountStr to set
     */
    public void setAmountStr(String amountStr) {
        this.amountStr = amountStr;
    }
    
    public double getAmount() {
        double amount = 0.0d;
        try {
            amount = Double.parseDouble(this.amountStr);
        } catch (NumberFormatException e) {
            amount = 0.0d;
        }
        return amount;
    }
    
    public String toString() {
        return ReflectionToStringBuilder.toString(this,
                ToStringStyle.MULTI_LINE_STYLE);
    }
}
